<template>
  <div>
    <main-layout>
      <div class="list-container">
        <auth-tag code="10001" tips="无权访问">
          <vTable   ref="vGridTable" 
                :columnsList="columnsList"
                apiUrl="boss/tanc_plantint_plan_report/list"
                :pageSize="15"
                :formConfig="formConfig"
                :toolbarConfig="false"
                :queryData="{
                  companyId:userStore.userInfo.companyId,
                  farmId:userStore.userInfo.farmId
                  }">
                <template #actions="{row}">
                  <auth-tag code="10001">
                     <el-button icon="view" class="btn-view" size="small" @click="goDetail(row)">查看报告</el-button>
                  </auth-tag>
                  </template>
            </vTable>
        </auth-tag>
      </div>
    </main-layout>

  </div>
</template>

<script setup name="System-Account-List">
import { nextTick, ref, watch, onActivated, reactive, computed,onMounted } from 'vue'
import { useRouter } from 'vue-router'
import mainLayout from '@/components/custom/mainLayout.vue'
import { useUserStore } from '@/pinia/modules/user'
const router = useRouter()
const userStore = useUserStore()

const  formConfig = computed(
    ()=>{
    return {
        titleWidth: 100,
        titleAlign: 'center',
        items: [
        {
            field: 'planNumber',
            title: '计划编号',
            span: 5,
            itemRender: {name: '$input', props: {placeholder: '请输入计划编号', clearable: true}}
          },
          {
            field: 'reportNumber',
            title: '报告编号',
            span: 5,
            itemRender: {name: '$input', props: {placeholder: '请输入报告编号', clearable: true}}
          },
          {
            field: 'dateRange',
            title: '生成日期',
            span: 5,
            slots: { default: 'dateRange' }
          },
          {
            align: 'center', collapseNode: false,
            itemRender: {
              name: '$buttons',
              children: [
                {props: {type: 'submit', icon: 'vxe-icon-search', content: '查询', status: 'primary'}},
                {props: {type: 'reset', icon: 'vxe-icon-refresh', content: '重置'},events: { click: (row,data)=>{
                  row.data.dateRange=[]
              }}}
              ]
            }
          }
        ]
    }
   })

const columnsList = ref([
      {type: 'seq', title: '序号',width:'60',align:'center'},
      {field: 'createTime', title: '生成日期',minWidth:'160',align:'center'},
      {field: 'reportNumber', title: '报告编号',minWidth:'110',align:'center'},
      {field: 'planNumber', title: '计划编号',minWidth:'130',align:'center'},
      {field: 'planName', title: '作物品种',minWidth:'180',align:'center'},
      {title: '操作', width: 120,fixed:'right', slots: {default: 'actions'}}
   ])


   const goDetail = (item) => {
  // framStore.set_backUrl('/system/opinion/list')
  router.push(`/report/detail?id=${item.plantingPlanReportId}`)
}

</script>

<style lang="scss" scoped>
.inputLine {
  display: flex;
  width: 300px;
  .zhi{
    padding: 0 10px;
  }
  s{
    font-style: normal;
    text-decoration: none;
    padding: 0 0 0 5px;
    color: var(--el-text-color-regular);
  }
}
</style>
